home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #3 / Amiga Plus CD - 2002 - No. 03.iso / AmigaPlus / AmigaOS / Aplus_Dev / AP-Website / links / include / related.php < prev    next >
Encoding:
PHP Script  |  2002-10-28  |  2.0 KB  |  96 lines

  1. <?
  2. // *******************************************************************
  3. //  include/related.php
  4. // *******************************************************************
  5.  
  6. unset($html);
  7. unset($gcid);
  8. unset($pid_array);
  9. unset($id_array);
  10. unset($cat_array);
  11. unset($count2);
  12. unset($ID);
  13.  
  14. $query = sql_query("
  15.     select
  16.         *
  17.     from
  18.         $tb_related
  19.     where
  20.         cat_id = '$PID'
  21. ");
  22.  
  23. $count = sql_num_rows($query);
  24.  
  25. if($count > 0){
  26.  
  27.     $htmlsrc = "\r\n<!-- Related Categories Start -- include/related.php -->\r\n";
  28.     $htmlsrc .= $table2 . "\r\n<tr>\r\n\t<td class=\"whatText\">";
  29.     $htmlsrc .= $related_1 . "</td>\r\n</tr>\r\n</table>\r\n";
  30.  
  31.     echo whattable("100%","center","",$htmlsrc);
  32.     unset($htmlsrc);
  33.  
  34.     $htmlsrc .= $table2 . "\r\n<tr>\r\n\t<td class=\"regularText\">";
  35.     
  36.     while($array = sql_fetch_array($query)){
  37.                 
  38.             $gcid = $array["rel_id"];
  39.                 
  40.             while($gcid > 0){
  41.  
  42.                 $mlc_sql = "
  43.                     select
  44.                         *
  45.                     from
  46.                         $tb_categories
  47.                     where
  48.                         ID = '$gcid'
  49.                 ";
  50.  
  51.                 $mlc_query = sql_query($mlc_sql);
  52.                 $mlc_array = sql_fetch_array($mlc_query);
  53.         
  54.                 $cat_array[] = $mlc_array["Category"];
  55.                 $pid_array[] = $mlc_array["PID"];
  56.                 $id_array[] = $mlc_array["ID"];
  57.         
  58.                 $gcid = $mlc_array["PID"];
  59.             }
  60.                 
  61.             $count2 = sizeof($pid_array);
  62.         
  63.             $htmlsrc .= "<a class=\"regularText\" href=\"index.php?";
  64.             $htmlsrc .= session_name() . "=" . session_id() . "&PID=";
  65.             $htmlsrc .= $id_array[0] . "\">";
  66.             
  67.             for($depth = $count2; $depth >= 0; $depth--){
  68.             
  69.                 if(isset($pid_array[$depth])){
  70.                     $html .= " >> ";
  71.                     $html .= ereg_replace("_", " ", $cat_array[$depth]);
  72.                     $html .= " ";
  73.                 }
  74.  
  75.             }
  76.             
  77.             $htmlsrc .= trim($html);
  78.             $htmlsrc .= "</a><br />";
  79.         
  80.         unset($html);
  81.         unset($gcid);
  82.         unset($pid_array);
  83.         unset($id_array);
  84.         unset($cat_array);
  85.         unset($count2);
  86.         unset($ID);
  87.     }
  88.     
  89.     $htmlsrc .= "</td>\r\n</tr>\r\n</table>\r\n";
  90. }
  91.  
  92. echo table("99%","center","",$htmlsrc);
  93. unset($htmlsrc);
  94.  
  95. ?>
  96.